
#include <QCoreApplication>
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    qDebug() << "Using systemd boot";
    bool wayland = true;
    const QString platform = wayland ? QStringLiteral("wayland") : QStringLiteral("x11");

    auto msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"),
                                              QStringLiteral("/org/freedesktop/systemd1"),
                                              QStringLiteral("org.freedesktop.systemd1.Manager"),
                                              QStringLiteral("StartUnit"));
    msg << QStringLiteral("plasma-workspace-%1.target").arg(platform) << QStringLiteral("fail");
    QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg);
    if (!reply.isValid()) {
        qWarning() << "Could not start systemd managed Plasma session:" << reply.error().name() << reply.error().message();
        // messageBox(QStringLiteral("startkde: Could not start Plasma session.\n"));
        // rc = false;
    } else {
        // playStartupSound(&e);
    }

    return a.exec();
}
